﻿$Global:ModuleVersion="1.0"
#$Global:ModuleName="Application.Management.CLient"
$Global:ModuleName="Application.Management.Core"

Write-Host "Start $ModuleName $ModuleVersion" -ForegroundColor Green
Write-Host "Identify User path : $home" -ForegroundColor Yellow

$modulePath = Get-location
$ModulePath = Join-Path -Path $modulePath -ChildPath "V$($ModuleVersion)"
Write-Host "Identify $ModuleName Module Path : $ModulePath" -ForegroundColor Yellow

$targetPath = Join-Path $home -ChildPath "Documents\WindowsPowerShell\Modules"
Write-Host "Identify User Module path : $targetPath" -ForegroundColor Yellow


Get-ChildItem -Path $ModulePath -Directory | ForEach-Object {
    $folderPath = Join-Path -Path $targetPath -ChildPath "$($_.Name)V1"
    Copy-Item -Path $_.FullName -Destination $folderPath -Container -Recurse -Force 
}

Import-Module $ModuleName -MinimumVersion $ModuleVersion -Force